import request from '@/request/index'
import { Bill, VariationType, BillInfo } from './type'

enum URL {
  MANAGE = 'bill/manage',
  MANAGE_FIND_USER = 'bill/manage/user',
  VARIATION_TYPE = 'bill/variation/type',
  VARIATION_BILL = 'bill/variation/bill',
  VARIATION_CARD = 'bill/variation/card',
  VARIATION = 'bill/variation',
}


export const getBillList = () => request.get<Bill[]>(URL.MANAGE) // 获取账单管理列表
export const saveBill = (data: any) => request.post(URL.MANAGE, data) // 保存账单
export const updateBill = (data: any) => request.put(URL.MANAGE, data)  // 更新账单信息
export const getVariationType = () => request.get<VariationType>(URL.VARIATION_TYPE) // 获取支付类型
export const getVariationBill = () => request.get(URL.VARIATION_BILL) // 获取账单列表
export const getVariationCard = () => request.get(URL.VARIATION_CARD) // 获取银行卡列表
export const saveVariation = (data: any) => request.post(URL.VARIATION, data) // 保存账单
export const getManageUser = (name: string) => request.get(URL.MANAGE_FIND_USER, { name })  // 查找管理用户
export const getBillInfo = (id: number) => request.get<BillInfo>(URL.MANAGE + `/${id}`)  // 获取账单信息